﻿@model IEnumerable<Mondial2014.Models.Competition.GroupFixture>

@{
    ViewBag.Title = "שלב הבתים";
}

<h2>משחקים בשלב הבתים</h2>
<br/>

<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.Number)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Date)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Group)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Team1)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Team2)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.GetScore)
        </th>
        <th></th>
</tr>

    @foreach (var item in Model.OrderBy(f => f.Date))
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Number)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Date)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Group.Number)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Team1.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Team2.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.GetScore)
            </td>
            <td>
                @if (item.Date <= DateTime.Now.AddHours(1)) 
                {
                    @Html.ActionLink("עדכן תוצאה", "Edit", new { id = item.Id })
                }
            </td>
        </tr>
    }

</table>